/*
 * 菜单管理模块
 */

// 获取导航菜单树
export function findNavTree() {
  const navTreeData = {
    "code": 200,
    "msg": null,
    "data": [
      // {
      //   "id": 1,
      //   "name": '首页',
      //   "icon": "el-icon-house",
      //   "children": [{
      //     "id":11,
      //     "parentId": 1,
      //     "name": "数据统计",
      //     "url": "/index"
      //   }]
      // },
      {
        "id": 2,
        "name": "会员管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-user",
        "children": [{

          "parentId": 2,
          "id":21,
          "name": "会员列表",
          "url": "/user/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {

          "parentId": 2,
          "id":22,
          "name": "收货地址",
          "url": "/userAddress/index",
          "perms": null,
          "icon": "",
          "children": [
            {
              'url':'/userAddress/update',
              'name':'更新地址',
              'prems':'',
            }
          ]
        }


      ]
      },
      {
        "id": 3,
        "name": "团长管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-sell",
        "children": [{

          "parentId": 3,
          "id":31,
          "name": "团长列表",
          "url": "/regimental/index",
          "perms": null,
          "icon": "",
          "children": []
        }]
      },
      {
        "id": 4,
        "name": "商品管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-shopping-bag-2",
        "children": [{

          "parentId": 4,
          "id":41,
          "name": "商品列表",
          "url": "/goods/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {

          "parentId": 4,
          "id":42,
          "name": "商品分类",
          "url": "/goodsCategory/index",
          "perms": null,
          "icon": "",
          "children": [{
            'url':'/goodsCategory/update',
            'name':'更新分类',
            'prems':'',
          },
          {
            'url':'/goodsCategory/add',
            'name':'增加分类',
            'prems':'',
          }]
        },
        {

          "parentId": 4,
          "id":43,
          "name": "商品类型",
          "url": "/goods/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {

          "parentId": 4,
          "id":44,
          "name": "商品评论",
          "url": "/goods/index",
          "perms": null,
          "icon": "",
          "children": []
        }
      ]
      },
      {
        "id": 5,
        "name": "订单管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-collection",
        "children": [{

          "parentId": 5,
          "id":51,
          "name": "订单列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        }]
      },
      {
        "id": 6,
        "name": "售后管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-male",
        "children": [{

          "parentId": 6,
          "id":61,
          "name": "退货申请列表",
          "url": "/afterSale/return",
          "perms": null,
          "icon": "",
          "children": []
        },
        {

          "parentId": 6,
          "id":62,
          "name": "退款申请列表",
          "url": "/afterSale/refund",
          "perms": null,
          "icon": "",
          "children": []
        },
        {

          "parentId": 6,
          "id":63,
          "name": "换货申请列表",
          "url": "/afterSale/replace",
          "perms": null,
          "icon": "",
          "children": []
        },

      ]
      },
      {
        "id": 7,
        "name": "供应商管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-coffee",
        "children": [{

          "parentId": 7,
          "id":71,
          "name": "供应商列表",
          "url": "/supplier/index",
          "perms": null,
          "icon": "",
          "children": []
        }
      ]
      },

      {
        "id": 8,
        "name": "活动管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-news",
        "children": [{
          "parentId": 8,
          "id":81,
          "name": "轮播图",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 8,
          "id":82,
          "name": "秒杀",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 8,
          "id":83,
          "name": "大礼包",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        }
      ]
      },

      {
        "id": 9,
        "name": "分销管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-medal-1",
        "children": [{
          "parentId": 9,
          "id":91,
          "name": "申请提现",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 9,
          "id":92,
          "name": "提现记录",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        }
      ]
      },


      {
        "id": 10,
        "name": "品牌管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-school",
        "children": [{
          "parentId": 10,
          "id":101,
          "name": "品牌列表",
          "url": "/brand/index",
          "perms": null,
          "icon": "",
          "children": [
            {
              'url':'/brand/update',
              'name':'更新品牌',
              'prems':'',
            },
            {
              'url':'/brand/add',
              'name':'增加品牌',
              'prems':'',
            }
          ],
        },
      ]
      },
      {
        "id": 11,
        "name": "财务管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-wallet",
        "children": [{
          "parentId": 11,
          "id":111,
          "name": "申请提现",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 11,
          "id":112,
          "name": "提现记录",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
      ]
      },
      {
        "id": 12,
        "name": "客服管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-headset",
        "children": [{
          "parentId": 12,
          "id":121,
          "name": "客服列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
      ]
      },
      {
        "id": 14,
        "name": "内容管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-document",
        "children": [{
          "parentId": 14,
          "id":141,
          "name": "文章列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
      ]
      },
      {
        "id": 15,
        "name": "权限管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-coordinate",
        "children": [
          {
            "parentId": 15,
            "id":151,
            "name": "管理员列表",
            "url": "/order/index",
            "perms": null,
            "icon": "",
            "children": []
          },
          {
          "parentId": 15,
          "id":152,
          "name": "角色列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 15,
          "id":153,
          "name": "菜单列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 15,
          "id":154,
          "name": "权限列表",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        },
      ]
      },
      {
        "id": 16,
        "name": "系统管理",
        "url": null,
        "perms": null,
        "icon": "el-icon-setting",
        "children": [
        {
          "parentId": 16,
          "id":161,
          "name": "运费模板",
          "url": "/freight/index",
          "perms": null,
          "icon": "",
          "children": [
            {
              'url':'/freight/update',
              'name':'更新模板',
              'prems':'',
            },
            {
              'url':'/freight/add',
              'name':'增加模板',
              'prems':'',
            }
          ]
        },
        {
          "parentId": 16,
          "id":162,
          "name": "物流公司",
          "url": "/freight/index",
          "perms": null,
          "icon": "",
          "children": []
        },
        {
          "parentId": 16,
          "id":163,
          "name": "操作日志",
          "url": "/order/index",
          "perms": null,
          "icon": "",
          "children": []
        }
      ]
      },




    ]
  }
  return {
    url: 'menu/findNavTree',
    type: 'get',
    data: navTreeData
  }
}

export function setParentName(data) {
  if (data == null) {
    return
  }
  let len = data.length
  for (let i = 0; i < len; i++) {
    let menu = data[i]
    menu.parentName = 'menu' + menu.parentId
    if (menu.children != null) {
      setParentName(menu.children)
    }
  }
}
